#!/bin/bash

if [ $# -lt 2 ];then
	echo "请指定两个数"
	exit 1
fi

num1=$1
num2=$2

if [ $num1 -eq $num2 ];then
	echo "两个数相等，和为:$num1"
	exit 0
fi

if [ $num1 -lt $num2 ];then
	start=$num1
        end=$num2
else
	start=$num2
        end=$num1
fi

sum=0
for ((i=start;i<=end;i++))
do
	sum=$((sum+i))
done

echo "从$start到$end的所有整数和为：$sum"

